<?php

namespace app\common\validate;

use think\Validate;

class Hd extends Validate {

    protected $rule = [
        'id' => 'require|number',
        'prize_id' => 'require|number',
        'prize' => 'length:0,50',
        'probability' => 'require',
        'limitnum' => 'require|number',
        'img_url' => 'require|url',
        'header_img' => 'require|url',
        'parent_id' => 'require|number|between:1,6',
        'is_delete' => 'require|number|between:0,1',
        'user_id' => 'number',
        'prize_id' => 'require|number',
        'add_time' => 'require',
        'type_id'=>'require|number|between:1,2',
        'type_name'=>'require',
        'start_time'=>'require',
        'end_time' =>'require',
        'is_usepoint'=>'number|between:0,1',
        'is_everyday'=>'number|between:0,1',
        'points'=>'number',
        'free_time'=>'number',
        'user_limitnum'=>'require|number',
        'source_id'=>'number',
        'type'=>'number|between:1,4',
    ];
    protected $field = [
        'prize_id' => '礼品id',
        'prize' => '礼品',
        'probability' => '概率',
        'limitnum' => '限量',
        'img_url' => '礼品图',
        'header_img' => '弹出图',
        'parent_id' => '类型',
        'is_delete' => '状态',
        'user_id' => '用户id',
        'prize_id' => '奖项',
        'add_time' => '中奖时间',
        'type_name'=>'类型',
        'start_time'=>'开始时间',
        'end_time' =>'结束时间',
        'is_usepoint'=>'使用积分状态',
        'is_everyday'=>'是否每天开启',
        'points'=>'积分值',
        'free_time'=>'免费次数',
        'user_limitnum'=>'用户限量',
        'type_id'=>'活动类型',
        'source_id'=>'关联id',
        'type'=>'抽奖类型'
    ];
    protected $scene = [
        'id'=>['id'],
        'edit' => ['prize_id','prize','probability', 'limitnum', 'img_url', 'header_img', 'parent_id','is_delete','user_limitnum','type_id','source_id'],
        'add' => ['prize','probability', 'limitnum', 'img_url', 'header_img', 'parent_id','is_delete','user_limitnum','type_id','source_id'],
        'addhd' => ['user_id','prize_id', 'add_time', 'is_delete'],
        'getrandprize' => ['type_id'],
        'typeedit' => ['type_id','type_name','start_time', 'end_time', 'is_usepoint', 'is_everyday', 'is_delete','points','free_time'],
        'typeadd' => ['type_name','start_time', 'end_time', 'is_usepoint', 'is_everyday', 'is_delete','points','free_time'],
    ];

}
